import {IconifyInfo, IconifyJSON} from "@iconify/types"

/**
 * 获取 Iconify 指定图标集中图标列表时返回的结果对象类型
 */
export interface IconifySetIcons {
  // Icon set prefix
  prefix: string;
  // Number of icons (duplicate of info?.total)
  total: number;
  // Icon set title, if available (duplicate of info?.name)
  title?: string;
  // Icon set info
  info?: IconifyInfo;
  // List of icons without categories
  uncategorized?: string[];
  // List of icons, sorted by category
  categories?: Record<string, string[]>;
  // List of hidden icons
  hidden?: string[];
  // List of aliases, key = alias, value = parent icon
  aliases?: Record<string, string>;
  // Characters, key = character, value = icon name
  chars?: Record<string, string>;
  // Themes
  themes?: IconifyJSON['themes'];
  prefixes?: IconifyJSON['prefixes'];
  suffixes?: IconifyJSON['suffixes'];
}

/**
 * 搜索 Iconify 图标时的请求参数类型
 */
export interface SearchIconifyIconsParams {
  query: string;
  limit?: number;
  start?: number;
  prefixes?: string[];
  category?: string;
}

/**
 * 搜索 Iconify 图标时返回的结果对象类型
 */
export interface SearchIconifyIconsResult {
  // List of icons, including prefixes
  icons: string[];
  // Number of results. If same as `limit`, more results are available
  total: number;
  // Number of results shown
  limit: number;
  // Index of first result
  start: number;
  // Info about icon sets
  collections: Record<string, IconifyInfo>;
  // Copy of request, values are string
  request: Record<keyof SearchIconifyIconsParams, string>;
}
